"""
API数据模型定义
"""

from typing import Optional
from pydantic import BaseModel, Field


class HealthResponse(BaseModel):
    """健康检查响应模型"""

    status: str = Field(..., description="服务状态")
    version: str = Field(..., description="API版本")

    class Config:
        json_schema_extra = {"example": {"status": "healthy", "version": "1.0.0"}}


class ErrorResponse(BaseModel):
    """错误响应模型"""

    detail: str = Field(..., description="错误详情")
    error_code: Optional[str] = Field(None, description="错误代码")

    class Config:
        json_schema_extra = {
            "example": {
                "detail": "下载图片失败: Connection timeout",
                "error_code": "IMAGE_DOWNLOAD_ERROR",
            }
        }
